package org.example.scenicspot.service;

import org.example.scenicspot.domain.EmergencyRescuePerson;
import org.example.scenicspot.domain.EmergencyRescueVehicle;
import org.example.scenicspot.domain.Staff;
import org.example.scenicspot.persistence.emergencyRescuePersonMapper;
import org.example.scenicspot.persistence.staffMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class emergencyRescuePersonService {
    @Autowired
    emergencyRescuePersonMapper emergencyRescuePersonMapper;
    public List<EmergencyRescuePerson> showemergencyRescuePerson(){
        return emergencyRescuePersonMapper.selectAll();
    }

    public  List<EmergencyRescuePerson> searchemergencyRescuePerson(String keyword){
        return emergencyRescuePersonMapper.selectByName(keyword);
    }

    public  List<EmergencyRescuePerson> selectByScenicAreaID(int scenicAreaID){
        return emergencyRescuePersonMapper.selectByScenicAreaID(scenicAreaID);
    }

    public  void deleteemergencyRescuePerson(int id){
        emergencyRescuePersonMapper.deleteById(id);
    }

    public  void insertemergencyRescuePerson(EmergencyRescuePerson emergencyRescuePerson){
        emergencyRescuePersonMapper.insert(emergencyRescuePerson.getId(),emergencyRescuePerson.getName(),emergencyRescuePerson.getQualification(),emergencyRescuePerson.getContactInfo(),emergencyRescuePerson.getScenicAreaID());
    }

    public  void updateemergencyRescuePerson(EmergencyRescuePerson emergencyRescuePerson){
        emergencyRescuePersonMapper.update(emergencyRescuePerson.getId(),emergencyRescuePerson.getName(),emergencyRescuePerson.getQualification(),emergencyRescuePerson.getContactInfo(),emergencyRescuePerson.getScenicAreaID());
    }
}
